package com.dingyx.ps.util;

import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 〈配置属性获取工具〉
 * @author ZhangYang
 * @date 2020/12/30 9:39
 * @version 1.0.0
 */
@Component
public class PropertyUtil {

    @Resource
    private ConfigurableApplicationContext configurableApplicationContext;

    /**
     * 〈获取配置属性〉
     * @param key 属性key
     * @return java.lang.String
     * @author ZhangYang
     * @date 2020/12/30 9:40
     * @version 1.0.0
     */
    public String getProperties(String key){
        return configurableApplicationContext.getEnvironment().getProperty(key);
    }
}
